using System;
using NsbExtensions.EndpointMetadata;
using NsbExtensions.Utilities;
using NServiceBus;

namespace NsbExtensions
{
    public interface IMessagingEndpoint : IBackgroundService
    {
        IBus Bus { get; }
        IEndpointDescription Metadata { get; }
        event EventHandler<EndpointEventArgs> EndpointOnline;
        event EventHandler<EndpointOfflineEventArgs> EndpointOffline;
        event EventHandler<ErrorEventArgs> ServiceException;

        void TakeEndpointOffline(string reason, TimeSpan outageDuration);
        void Restart(string reason);
    }
}